VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Crystal Reports Snip->(Change SQL on Compiled Report) This snip changes the SQL and DB location in

by Anthony Loera (7 Submissions)
Category: Databases/Data Access/DAO/ADO
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 17th May 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Crystal Reports Snip->(Change SQL on Compiled Report) This snip changes the SQL and DB location in a COMPILED report. (a report that was

Rate Crystal Reports Snip->(Change SQL on Compiled Report) This snip changes the SQL and DB location in



'the Crystal Reports 8.5 ActiveX Designer Run Time Library

Public Function ViewReport(ByVal strSQL As String, ByVal strReportFile As String)
Dim CRReport As CRAXDRT.Report
Dim CrxApp As New CRAXDRT.Application
Dim dbTable As CRAXDRT.DatabaseTable

'Required: Use the OpenReport method of the Application object to open the report.
Set CRReport = New CRAXDRT.Report
Set CrxApp = CreateObject("crystalruntime.application")
Set CRReport = CrxApp.OpenReport(strReportFile)

'Required: Prepare the tables to look at the correct database for a dynamic query
For Each dbTable In CRReport.Database.Tables
    dbTable.SetLogOnInfo "Servername", "databasename", "username", "password"
Next dbTable

'Required: Add dynamic Query to Compiled report
CRReport.SQLQueryString = strSQL

CRViewer1.ReportSource = CRReport

'CRReport.PrintOut False, 1, True
CRViewer1.ViewReport
Form1.Visible = True

Set CRReport = Nothing
Set CrxApp = Nothing
Set CRReport = Nothing

End Function

Download this snippet    Add to My Saved Code

Crystal Reports Snip->(Change SQL on Compiled Report) This snip changes the SQL and DB location in Comments

No comments have been posted about Crystal Reports Snip->(Change SQL on Compiled Report) This snip changes the SQL and DB location in . Why not be the first to post a comment about Crystal Reports Snip->(Change SQL on Compiled Report) This snip changes the SQL and DB location in .

Post your comment

Subject:
Message:
0/1000 characters